package commands;

import java.awt.Image;
import java.util.Hashtable;

import devices.Heater;

import annotations.Command;
import annotations.Param;


@Command(name="Set temperature", description="Sets the temperature to specific value", id=1)
public class HeaterTemperatureCommand implements CommandInterface{
	
	@Param(
			id=1,
			name="max",
			mandatory=true,
			description="The temperature which will never be exceeded"
	)
	public int maxTemperature;
	
	@Param(
			id=2,
			name="desired",
			mandatory=true,
			description="Desired temperature"
	)
	public int desiredTemperature;
	
	@Param(
			id=3,
			name="economic",
			description="In economic mode, heater will only be activated during off peak hours or when temperature gets too low"
	)
	public boolean economic;
	
	@Override
	public Object getInitialValueFor(Param p, Hashtable<Integer, Object> deviceData) {
		
		int paramId = p.id();
		switch (paramId){
		case 1: return deviceData.get(Heater.MAXTEMPERATURE);
		case 2: return deviceData.get(Heater.DESIREDTEMPERATURE);
		case 3: return deviceData.get(Heater.ECONOMIC);
		}
		
		return null;
	}
	
}
